{% extends "admin/base_site.html" %}
{% load i18n admin_modify adminmedia admin_display productos_tags%}

{% block extrahead %}{{ block.super }}

<script language="JavaScript">
function Abrir_ventana (pagina) {
var opciones="toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, width=600, height=500, top=85, left=140";
window.open(pagina,"",opciones);
window.opener.location.reload();
self.close();
}
$(document).ready(function(){
$(".stripeMe tr").mouseover(function() {
  $(this).not(".title, .title2").addClass("over");
});
$(".stripeMe tr").mouseout(function() {
  $(this).not(".title, .title2").removeClass("over");
});

$(".stripeMe tr:even").not(".title, .title2").addClass("alt");
$('#submit').click(function() {
      Abrir_ventana('/gestion/admin/productos/producto/add/');
      alert("tengo chaleco bolo");
});

});

</script>

<style>

tr.alt td{
    background: #ecf6fc;
}
tr.over td {
    background: #bcd4ec;
}
.title td {
    color:#FFFFFF;
    background: #336699;
}
.title2 td {
    color:#000000;
    background: #FFCC99;


}
</style>
{{ media }}
{% endblock %}
{% load cheques_tags %}

{% block stylesheet %}{% admin_media_prefix %}css/forms.css{% endblock %}

{% block coltype %}{% if ordered_objects %}colMS{% else %}colM{% endif %}{% endblock %}

{% block bodyclass %}

{{ opts.app_label }}-{{ opts.object_name.lower }} change-form 

{% endblock %}

{% block breadcrumbs %}

{% if not is_popup %}
<div class="breadcrumbs">
     <a href="../">{% trans "Home" %}</a> &rsaquo;
     <a href="../">{{ opts.verbose_name_plural|capfirst }}</a> &rsaquo;
     {% if add %}{% trans "Add" %} {{ opts.verbose_name }}{% else %}{{ original|truncatewords:"18" }}{% endif %}
</div>
{% endif %} {% endblock %}


{% block content %}<div id="content-main">
{% block object-tools %}
{% if not is_popup %}
 
  <ul class="object-tools">
  	<li><a href="../" class="backlink">Volver</a></li>
  	{% if has_absolute_url %}<li><a href="../../../r/{{ content_type_id }}/{{ object_id }}/" class="viewsitelink">{% trans "View on site" %}</a></li>{% endif%}
	
</ul>
{% endif %}
<form action="." method="POST">

<table border=1 class="stripeMe">
{% regroup prod by familia as grouped %}

	{% for group in grouped %}
		<tr class="title2"><td colspan="4"><h3>{{group.grouper }}</h3></td><td></td><td></td><td></td></tr>

		<tr class="title"><td><u>Nombre</u></td><td><u>Unidad de medida</u></td><td><u>Cantidad esperada</u></td><td><u>Moneda</u></td><td><u>Precio de venta</u></td><td><u>Precios de compra</u></td><td></td></tr>
		{% for item in group.list %}
		<tr><td><a href="javascript:Abrir_ventana('/gestion/admin/productos/{{item.id}}/producto')">{{item.nombre}}</a></td><td>{{item.unidad_medida}}</td><td><a href="javascript:Abrir_ventana('/gestion/admin/productos/{{item.id}}/cantidad')">{{item.cantidad_esperada}}</a></td><td>{{item.moneda}}</td><td>{{item.precio_venta}}</td><td>{% get_familia item %}</td><td><a href="javascript:Abrir_ventana('/gestion/admin/productos/{{item.id}}/precio')">Editar precios</a></td></tr>
		{% endfor %}

{% endfor %}
</table>

<INPUT TYPE="button" value="Agregar nuevo" id="submit"> 


</div>
{% endblock %}
<form {% if has_file_field %}enctype="multipart/form-data" {% endif %}action="{{ form_url }}" method="post" id="{{ opts.module_name }}_form">{% block form_top %}{% endblock %}
</form></div>
{% endblock %}
